# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=pev
pkgver=0.81
pkgrel=6
groups=('blackarch' 'blackarch-forensic' 'blackarch-reversing')
pkgdesc='Command line based tool for PE32/PE32+ file analysis.'
arch=('x86_64' 'aarch64')
url='http://pev.sourceforge.net/'
license=('GPL3')
depends=('glibc' 'openssl' 'pcre')
source=("http://sourceforge.net/projects/$pkgname/files/$pkgname-$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('abf0087b7b3943edf41c47d8572c5b239368aa2b9afcefb3117beeb6ffd34ad3fdfb8c5779ab93ecc5f54b8745daf9030ed6636e9eb32d6d315d383cc3b0bd24')

prepare() {
  cd "$pkgname-$pkgver"

  find . -type f -name "Makefile" -exec \
    sed -i 's|^datarootdir = |datarootdir = \$(DESTDIR)/|' {} +
}

build() {
  cd "$pkgname-$pkgver"

  make
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/lib"

  make DESTDIR="$pkgdir" install

  mv "$pkgdir/usr/local/bin" "$pkgdir/usr/bin"
  mv "$pkgdir/usr/local/lib/"libpe* "$pkgdir/usr/lib/"
  mv "$pkgdir/$pkgdir/usr/local/share" "$pkgdir/usr/share"
  rm -rf "$pkgdir/"{home,build,"usr/lib/$pkgname"}
}

